package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.wx.goods.vo.UserIndexVo;
import com.cskaoyan.service.wx.WxOrdersService;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Classname UserController
 * @Description
 * @Date 2021/8/14 14:24
 * @Author : xujun
 */
@RestController
@RequestMapping("wx/user")
public class WXUserController {

    @Autowired
    WxOrdersService wxOrdersService;

    /**
     * 用户界面显示4种状态的数量：未收货、未付款、未评论、未发货
     * @return
     */
    @RequestMapping("index")
    public BaseRespVo index() {

        // TODO 权限验证后再改回来
        String username = (String) SecurityUtils.getSubject().getPrincipal();
//        String username = "test1";

        UserIndexVo vo = wxOrdersService.index(username);

        return BaseRespVo.ok(vo);
    }

}
